﻿@model IEnumerable<PhotoGallery.Models.PublicAlbumInfo>
@using PhotoGallery.Views
@{
    ViewBag.Title = "Index";
}
@using PagedList.Mvc; @*//import this so we get our HTML Helper*@
@using PagedList; @*//import this so we can cast our list to IPagedList (only necessary because ViewBag is dynamic)*@

@section javascript{
<!-- import the included stylesheet for some (very basic) default styling -->
    <link href="@Url.Content("~/Content/PagedList.css")" rel="stylesheet" type="text/css" />
}

<h2>@Labels.albums</h2>
@*<p>
    @Html.ActionLink(Labels.add, "Create")
</p>*@
<!-- loop through each of your products and display it however you want. we're just printing the name here -->
<ul class="thumbnails">
        <li class="item">
        <div>                       
            <a href="@Url.Action("List","Albums")">
                <img alt="" src="@Url.Content("~//Content//no_photo.jpg")" class="thumbnail-border" width="180" />
            </a>
        </div>
    </li>
    @if (Model.Count() > 0)
    {
        foreach (var album in ViewBag.OnePageOfProducts)
        {
            <li class="item">
            <div>
                <a href="@Url.Action("Preview","Gallery",new { albumId = album.ID })">
                    @if (String.IsNullOrEmpty(album.FileName))
                    {
                        <img alt="" src="@Url.Content("~//Content//empty_album.png")" class="thumbnail-border" width="180" height="180" />
                    }
                    else
                    {
                        @*<img alt="@album.Title" src="@Url.Action("Thumbnail", new { file = album.FullFileName })"/>*@
                        <img alt="@album.Title"  src="@Url.Content(album.Url)" />
                    }
                </a>
                <p>
                    @*@Html.ActionLink(Labels.photo, "List","Photo",  new { albumId = album.ID }, new { @class = "button-link" })*@
                    @Html.ActionLink(Labels.video, "Show", "Gallery", new { albumId = album.ID }, new { @class = "button-link-80" })
                    @Html.ActionLink(Labels.audio, "Play","Gallery",  new { albumId = album.ID }, new { @class = "button-link-80" })
                </p><br />
                <p>@album.Title</p>
@*                <span class="image-overlay">
                    @Html.ActionLink(Labels.info, "Details","Albums",  new { id = album.ID },null)
                    @Html.ActionLink(Labels.edit, "Edit", "Albums", new { id = album.ID},null)
                    @Html.ActionLink(Labels.delete,"Delete","Albums", new { id = album.ID }, null)                    
                </span>*@
            </div>
        </li>
        }
    }
    else
    {
        <li class="item">
            <div>                       
                <a href="#">
                    <img alt="" src="@Url.Content("~//Content//no_album.jpg")" class="thumbnail-border" width="180" />
                </a>
            </div>
        </li>
    }
</ul>

<!-- output a paging control that lets the user navigation to the previous page, next page, etc -->
<div style="clear:both">
    @Html.PagedListPager( (IPagedList)ViewBag.OnePageOfProducts, page => Url.Action("List", new { page }) )
</div>
